﻿Imports System.Text

Public Class Persona
  Private m_cognome As String
  Private m_nome As String
  Private m_dataNascita As Date
  Public Property cognome() As String
    Get
      Return m_cognome
    End Get
    Set(ByVal value As String)
      If value <> "" Then
        m_cognome = value
      End If
    End Set
  End Property
  Public Property nome() As String
    Get
      Return m_nome
    End Get
    Set(ByVal value As String)
      If value <> "" Then
        m_nome = value
      End If
    End Set
  End Property
  Public Property dataNascita() As Date
    Get
      Return m_dataNascita
    End Get
    Set(ByVal value As Date)
      If value <> Nothing Then
        m_dataNascita = value
      End If
    End Set
  End Property

  Public Overridable Function datiAnagrafici() _
        As String
    Dim sb As _
        New StringBuilder(Me.cognome & " " & _
        Me.nome & " - " & _
        Me.dataNascita.ToShortDateString)
    Return sb.ToString
  End Function

End Class
